<template>
  <a-modal :visible="show" width="80vw" title="变更详情" :maskClosable="false" :key="show" @cancel="show = false">
    <div style="max-height: 60vh; overflow-y: auto">
      <a-timeline :reverse="true">
        <a-timeline-item color="green" v-for="(version, index) in dataList" :key="index">
          <p>版本{{ index }}</p>
          <template v-for="(item, index1) in version">
            <p v-if="item.type != 'main'" :key="'log_' + index1">{{ item.context }} 操作人:{{item.createUser}} 操作时间:{{item.createTime}}</p>
            <template v-else>
              <template v-if="item.context">
                <p v-for="(context, index2) in JSON.parse(item.context)" :key="'context_' + index2">
                  {{ context.title + ': 旧值【' + context.oldValue + '】修改为新值【' + context.newValue + '】' }}
                  操作人:{{item.createUser}} 操作时间:{{item.createTime}}
                </p>
              </template>
            </template>
          </template>
        </a-timeline-item>
      </a-timeline>
    </div>
    <template slot="footer">
      <a-button @click="fetchList">刷新</a-button>
      <a-button @click="show = false"> 关闭 </a-button>
    </template>
  </a-modal>
</template>

<script>
import { postAction } from '@/api/manage'
import { formatDate } from '@/utils/util'
import { ResizeHandleMoreMixin } from '@/mixins/ResizeHandleMoreMixin'
import { UtilsMixin } from '@/mixins/UtilsMixin'
import { TableMixin } from '@/mixins/TableMixin'
import { CodesMixin } from '@/mixins/CodesMixin'

export default {
  name: 'TechnologyHistory',
  components: {},
  mixins: [ResizeHandleMoreMixin, CodesMixin, TableMixin, UtilsMixin],

  data() {
    return {
      url: {
        list: '/hteEngineeTechLibLogs/groups',
        export: '/hteEngineeTechLibHistory/export',
      },
      show: false,
      loading: false,
      dataList: [],
    }
  },
  computed: {},
  watch: {},
  mounted() {},
  methods: {
    formatDate,
    open(techId) {
      this.dataList = []
      this.searchForm.total = 0
      this.searchForm.pageNo = 0
      this.searchForm.current = 0
      this.searchForm.techId = techId
      this.show = true
      this.fetchList('mounted')
    },
    handleExportExcel() {
      let url = process.env.VUE_APP_API_BASE_URL + this.url.export + '?1=1'
      this.handleExportXls('工程技术库历史列表', url, this.searchForm)
    },
    ///////////////////////////////////////////////////////////////
    doDetail(record) {
      let urlJump = this.$router.resolve({
        path: `/engineeTech/edit?id=` + record.id + '&version=' + record.publishVersion,
      })
      window.open(urlJump.href, '_blank')
    },
    rowClassName(record) {
      return this.selectedRowKeys.indexOf(record.id) > -1 ? 'blue' : 'white'
    },
    fetchList(type = '') {
      this.loading = true
      this.dataList = []
      const that = this
      postAction(this.url.list, this.searchForm).then((res) => {
        if (res.success) {
          this.selectedRowKeys = []
          this.dataList = res.result
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false
      })
    },
  },
}
</script>

<style lang="less" scoped>
@import '~@views/library/hteFile.less';
/deep/ .j-table-force-nowrap {
  th {
    white-space: normal !important;
  }
}

.list-header {
  height: 28px;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  padding-left: 10px;

  span,
  a {
    // max-width: 15%;
    display: inline-block;
    font-weight: bold;
    font-size: 15px;
    padding-right: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  a {
    max-width: 70%;
  }
  .status {
    width: 68px;
    padding: 0 7px;
    text-align: center;
    position: absolute;
    right: 0;
    z-index: 999;
    position: absolute;
  }
}
/deep/ .list-content {
  .ant-col {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    text-align: left;
    padding-left: 10px;
  }
  .ant-col::after {
    position: absolute;
    top: 10%;
    right: 0;
    content: '';
    display: inline-block;
    height: 80%;
    width: 1px;
    background: #e8e8e8;
  }
  .ant-col.noline::after {
    display: none;
  }
}

.app-log {
  font-size: 24px;
  font-weight: bold;
}
.app-box-outter {
  width: 100%;
  display: flex;
  justify-content: center;
}
.app-box-inner {
  width: 70vw;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  position: relative;
}
.menu-list {
  width: 70vw;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  background-color: red;
}
.menu-item {
  padding: 22px 10px;
  font-size: 16px;
  font-weight: 200;
  color: #ffffff;
  cursor: pointer;
}
.condition-box {
  width: 70vw;
}
.condition-all {
  padding: 3px 10px;
}
.condition-list {
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  background-color: #ffffff;
}
.condition-item {
  display: flex;
  justify-content: flex-start;
  height: 40px;
  line-height: 40px;
  border-bottom: #f5f5f5 solid 1px;
}
.condition-label {
  width: 100px;
  padding-left: 10px;
}
.condition-value {
  display: flex;
  justify-content: flex-start;
}
.condition-value div {
  padding: 0px 10px;
}
.data-main {
  display: flex;
  justify-content: flex-start;

  padding-bottom: 15px;
}
.box-left {
  // width: 210px;
  background-color: #ffff;
  color: #000000;
  font-size: 16px;
  // min-width: 210px;
  // max-width: 210px;
  // height: 100%;
  // overflow:auto;
}
.ant-tree-switcher-line-icon {
  color: #ffffff !important;
}
.ant-tree li .ant-tree-node-content-wrapper {
  display: inline-block;
  height: 24px;
  margin: 0;
  padding: 0 5px;
  color: #ffffff;
  font-size: 14px;
  line-height: 24px;
  text-decoration: none;
  vertical-align: top;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s;
}
.box-right {
  background-color: #ffffff;
  font-size: 16px;
  position: relative;
  padding-bottom: 15px;
}
.main-top {
  display: flex;
  flex-wrap: wrap;
  > div {
    flex: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  /deep/ .ant-input-group.ant-input-group-compact {
    width: 16vw;
    display: inline-block;
  }
}
.main-top > div > * {
  margin: 5px;
}
.allSelect {
  position: absolute;
  top: 15px;
  left: 0;
  /deep/ .ant-checkbox + span {
    padding: 0;
  }
}
.fixed-menu {
  position: fixed;
  right: 20px;
  z-index: 1;
  width: 80px;
  top: 172px;
}
.functionMould {
  background-color: #ffffff;
  padding: 10px;
  text-align: center;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px;
  cursor: pointer;
  &:hover {
    > span,
    > i {
      color: #146595;
    }
  }
}
.functionMould > span {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: #000000;
  display: block;
}
.menu-icon {
  font-size: 24px;
  color: #31a0e1;
}
.ant-tree-switcher {
  background: unset !important;
}

/deep/ .avatar-uploader .el-upload-list__item-status-label {
  display: none;
}
/deep/ .ant-form input[type='file'] {
  display: none;
}
/deep/ .ant-btn-primary {
  background: #4095e4;
  margin-right: 10px;
}
/deep/ .ant-btn-primary[disabled] {
  background-color: #f5f5f5;
}
/deep/ .ant-btn {
  // width: 85px;
  height: 30px;
  border-radius: 2px;
  margin: 2px;
  padding: 0 7px;
  span {
    margin-left: 2px;
  }
}

/deep/.trademarkInfoPopUp {
  .headerControl {
    text-align: right;
    margin-bottom: 10px;
  }
  .ant-modal-title {
    font-weight: 900;
  }
  .ant-modal-footer {
    text-align: center;
    padding: 20px;
  }
  .ant-modal-header {
    text-align: center;
  }
  .ant-descriptions-bordered .ant-descriptions-item-label {
    width: 170px;
    background-color: #d9dee8;
    border-bottom: 1px solid #f7f7f7;
  }
  .ant-descriptions-view {
    border-radius: unset;
  }
  .ant-table-thead > tr > th {
    background: #dadee9 !important;
    padding: 10px;
  }
  .ant-table-thead > tr:first-child > th:first-child,
  .ant-table table {
    border-radius: unset;
    line-height: 1;
  }

  .ant-table-thead > tr:first-child > th:first-child,
  .ant-table table {
    border-radius: unset;
    line-height: 1;
  }
  .ant-table-tbody .ant-table-row td {
    padding-top: 10px;
    padding-bottom: 10px;
  }
}
/deep/ .productServicePopUp,
/deep/ .intellectualInfoPopUp,
/deep/.createTrademarkoPopUp {
  .ant-modal-title {
    font-weight: 900;
  }
  .ant-modal-header {
    text-align: center;
  }
  .ant-btn {
    width: fit-content;
  }
  .new-box {
    padding: 0 50px 20px;
  }
  .product-list {
    border: 1px solid #f5f5f5;
    border-radius: 3px;
    padding: 20px 50px;
    .product-name {
      margin-left: 20px;
    }
  }
  .ant-modal-footer {
    text-align: center;
    padding: 20px;
  }
  .btn {
    text-align: center;
    margin: 30px 0 0;
  }
  .ant-form-item {
    margin-bottom: 0;
  }
  .changeStyle .ant-form-item-label {
    line-height: unset;
    white-space: pre-wrap;
  }
  .upload-demo {
    /deep/ .ant-table-thead > tr > th {
      background: #d9dee8 !important;
    }
    /deep/.ant-table-thead > tr:first-child > th:first-child,
    /deep/ .ant-table table {
      border-radius: unset;
      line-height: 1;
    }
  }
}
/deep/ .selectKeywordPopUp {
  .ant-modal-title {
    font-weight: 900;
  }
  .ant-modal-header {
    text-align: center;
  }
  .ant-modal-footer {
    text-align: center;
    padding: 20px;
  }
}
/deep/ .processInforPopUp {
  .ant-modal-body {
    padding: 20px 75px;
  }
  .ant-timeline-item-head {
    background-color: #4095e4;
  }
  .ant-timeline-item-tail {
    border-left: 2px dotted #e8e8e8;
  }
  .processStep {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eee;
    padding: 0 10px;
    margin-top: 10px;
    .processTime {
      display: flex;
      font-weight: 700;
      span {
        display: inline-block;
        margin-right: 25px;
      }
    }
  }
}
/deep/ .mainTainPopUp,
/deep/ .selectAgencyPopUp,
/deep/.selectProposerPopUp,
/deep/ .selectServicePopUp,
/deep/ .productDetailPopUp {
  .ant-modal-title {
    color: #fff;
    font-weight: 900;
  }
  .ant-modal-body {
    padding: 24px 24px 0 24px;
  }
  .ant-input-group.ant-input-group-compact {
    display: flex;
    width: 40%;
  }
  .ant-modal-header {
    background: #388cdb;
    color: #fff;
    text-align: center;
  }
  .ant-modal-footer {
    text-align: center;
    padding: 20px;
  }
  .ant-btn-primary {
    background: #4095e4;
  }
  .ant-btn {
    width: 85px;
    height: 30px;
    border-radius: 2px;
    margin-right: 10px;
  }
  .ant-table-thead > tr > th {
    background: #dadee9 !important;
    padding: 10px;
  }
  .ant-table-thead > tr:first-child > th:first-child,
  .ant-table table {
    border-radius: unset;
    line-height: 1;
  }

  .ant-table-thead > tr:first-child > th:first-child,
  .ant-table table {
    border-radius: unset;
    line-height: 1;
  }
  .ant-table-tbody .ant-table-row td {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .headerControl {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
  }
  .selected-box {
    border: 1px solid #eeeeee;
    border-radius: 5px;
    padding: 0px 0 0 10px;
    .ant-select-selection {
      border: unset;
      border-left: 1px solid #eee;
      border-radius: unset;
      margin-left: 10px;
    }
  }
}
.toggleClick {
  background-color: #0581ca;
  border-bottom: 1px solid #1890ff;
  cursor: pointer;
}
.icon-plus {
  font-size: 13px;
  padding-right: 5px;
}
.main {
  min-height: 100%;
  background: #f5f5f5;

  position: relative;
}
.container {
  padding: 0 125px 100px;
  height: 100%;
  .trademark-nav {
    background: #fff;
    border-radius: 2px;
    border: solid 1px #e2e2e2;
    color: #000;
    -webkit-transition: max-height, margin-top 0.3s;
    transition: max-height, margin-top 0.3s;
    overflow: hidden;
    max-height: 700px;
    margin-top: 15px;
    .hoverShow {
      cursor: pointer;
      border-bottom: 3px solid rgba(255, 255, 255, 0);
      &:hover {
        border-bottom: 3px solid #31a0e1;
      }
    }
    .clickShow {
      border-bottom: 3px solid #31a0e1;
      color: #31a0e1;
      cursor: pointer;
    }
    .projec-class-box {
      font-weight: 600;
      // background: #f5f5f5;
      display: flex;
      border-bottom: 1px solid #f2f2f2;
      justify-content: center;
      align-items: center;
      &:last-of-type {
        border-bottom: none;
      }
      .projec-class-lable {
        width: 120px;
        padding: 10px 0 10px 30px;
        // float: left;
        font-size: 15px;
        text-align: left;
      }
      .projec-class-list {
        width: calc(100% - 120px);
        padding-left: 10px;
        color: rgba(0, 0, 0, 0.65);
        margin: 0;
        display: block;
        position: relative;
        padding: 0;
        list-style: none;
        li {
          float: left;
          padding: 10px 15px;
        }
      }
      &.projec-class-input {
        > div {
          flex: 1;
        }
        .projec-class-list {
          width: auto;
        }
      }
      .btn-more {
        display: none;
      }
      &.project-class-more {
        padding-right: 63px;
        position: relative;
        .btn-more {
          display: inline-block;
          position: absolute;
          right: 10px;
          top: 11px;
          padding: 0px 5px;
          cursor: pointer;
          color: #999;
          font-weight: normal;
          &:hover {
            color: #0581ca;
            background-color: #e4e4e4;
            .icon-child-down {
              color: #0581ca;
            }
          }
        }
        ul {
          -webkit-transition: all 0.3s;
          transition: all 0.3s;
          overflow: hidden;
          max-height: 700px;
          &.projec-class-list-more {
            max-height: 44px;
          }
        }
      }
    }
    &.trademark-nav-hidden {
      margin-top: 0;
      max-height: 0;
      border: 0;
    }
  }
  .trademark-tap {
    padding: 8px;
    width: 100%;
    text-align: center;
    color: #999;
    > span {
      padding: 5px;
      cursor: pointer;
      &:hover {
        color: #0581ca;
        background-color: #e4e4e4;
        .icon-child-down {
          color: #0581ca;
        }
      }
    }
  }
  .showTotal {
    vertical-align: middle;
  }
  .reservation-content {
    /deep/ .ant-table-body::-webkit-scrollbar-track {
      background: #fff;
    }
    margin-top: 20px;
    /deep/ .ant-table-small {
      border: unset;
      border-radius: unset;
    }
    /deep/ .ant-table-thead > tr > th {
      border: unset;
      border-radius: unset;
    }
    /deep/ .ant-table-thead {
      background-color: #d5dae4;
    }
    /deep/ .ant-table-small > .ant-table-content > .ant-table-body {
      margin: 0;
    }
  }
  .trademark-content {
    background: #fff;
    margin-top: 10px;
    border: 1px solid #ededed;
    .controlarea {
      padding: 15px 0 5px 10px;
    }
    .trademark-list {
      .reservation-content {
        margin-top: 20px;
        /deep/ .ant-table-small {
          border: unset;
          border-radius: unset;
        }
        /deep/ .ant-table-thead > tr > th {
          border: unset;
          border-radius: unset;
        }
        /deep/ .ant-table-thead {
          background-color: #f6f7f9;
        }
        /deep/ .ant-table-small > .ant-table-content > .ant-table-body {
          margin: 0;
        }
      }
    }
  }
}
/deep/ .ant-checkbox-group {
  width: calc(100% - 20px);
  margin: 0 10px;
}
/deep/ .ant-empty {
  margin: 20px;
}
@media (max-width: 1400px) {
  .trademark-nav {
    /deep/ input,
    /deep/ .ant-select {
      width: 152px !important;
    }
  }
}
@media all and (max-width: 1225px) {
  .projec-class-input {
    display: block !important;
    > div:not(:last-child) {
      border-bottom: 1px solid rgb(242, 242, 242);
    }
  }
}
@media (max-width: 1080px) {
  .container {
    padding: 0 30px 100px !important;
  }
}
.data-main .box-right .project-list .risk-list-hover {
  padding-right: 0;
}
.icon-child-down {
  font-size: 11px;
  margin-left: 3px;
  transition: all 0.3s;
  color: #999;
  &.icon-child-up {
    transform: rotate(180deg);
  }
}
/deep/ .ant-list * {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}
</style>
<style lang="less" scoped>
@import '~@assets/less/hte-main.less';

section {
  padding: 0;
  margin: 12px 0;
  background-color: #ffffff;
  border: solid 1px #e2e2e2;
  width: 100vw;
  .list-head {
    background-color: #ffffff;
    font-size: 14px;
    color: #333;
    padding: 7px 18px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .list-title {
    font-weight: bolder;
    margin-left: 15px;
    font-size: 16px;
    cursor: pointer;
  }
  .list-content {
    background-color: #fff;
    padding: 15px 18px 15px 50px;
    font-size: 14px;
    color: #666666;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
  }
  .list-content .left {
    display: flex;
    justify-content: flex-start;
    flex-direction: row;
  }
  .list-content .right {
    display: flex;
    justify-content: flex-start;
    flex-direction: row;
  }
  .list-content .left div {
    white-space: nowrap;
    margin-right: 10px;
  }
  .list-content .right div {
    white-space: nowrap;
    margin-left: 10px;
  }
}
.active1 {
  border: solid 1px #3168b1;
  background: #3168b1;
  color: white;
  font-weight: bold;
  border-top-left-radius: 10px;
  border-end-end-radius: 10px;
}

.active2 {
  color: #02a7f0;
  font-weight: bold;
}
</style>
